/// 菜单列表
class SysMenuVo {
  /// 主键id
  final int? menuId;
  /// 菜单名称
  final String? menuName;
  /// 菜单编码
  final String? menuCode;
  /// 菜单图标
  final String? icon;
  /// 菜单路由
  final String? url;
  /// 组件路径
  final String? src;
  /// 上级id
  final int? parentId;
  /// 排序编号
  final int? sort;
  /// 子权限列表
  final List<SysMenuVo>? children;

  SysMenuVo({
    this.menuId,
    this.menuName,
    this.menuCode,
    this.icon,
    this.url,
    this.src,
    this.parentId,
    this.sort,
    this.children,
  });

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (menuId != null) data['menuId'] = menuId;
    if (menuName != null) data['menuName'] = menuName;
    if (menuCode != null) data['menuCode'] = menuCode;
    if (icon != null) data['icon'] = icon;
    if (url != null) data['url'] = url;
    if (src != null) data['src'] = src;
    if (parentId != null) data['parentId'] = parentId;
    if (sort != null) data['sort'] = sort;
    if (children != null) data['children'] = children!.map((e) => e.toJson()).toList();
    return data;
  }

  factory SysMenuVo.fromJson(Map<String, dynamic> json) {
    return SysMenuVo(
      menuId: json['menuId'],
      menuName: json['menuName'],
      menuCode: json['menuCode'],
      icon: json['icon'],
      url: json['url'],
      src: json['src'],
      parentId: json['parentId'],
      sort: json['sort'],
      children: json['children'] != null ? List<SysMenuVo>.from(json['children'].map((x) => SysMenuVo.fromJson(x))) : [],
    );
  }
}